﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FirstFloor.ModernUI.Windows.Controls;
using Lephone.Data;

namespace SimlvClient.Pages
{
    /// <summary>
    /// Interaction logic for Home.xaml
    /// </summary>
    public partial class Home : UserControl
    {
        public Home()
        {
            InitializeComponent();
            GetData();
        }
        public Model.WebSites WebModel { get; set; }
        public void GetData()
        {         
                var Models = DbEntry.GetObject<Model.WebSites>(ConfigurationManager.AppSettings["websiteId"]);
                if (Models != null)
                {
                    WebModel = Models;
                    this.txtDescrpition.Text = Models.Description;
                    this.txtKeywords.Text = Models.Keywords;
                    this.txtTitle.Text = Models.Title;
                }
                //var catContent = DbEntry.GetObject<Model.StuBookChapter>(2233).ChapterContent;
                //ModernDialog.ShowMessageText(catContent);
        }

        //BtnSave
        private void BtnSave(object sender, RoutedEventArgs e)
        {
           // WebModel = DbEntry.GetObject<Model.WebSites>(ConfigurationManager.AppSettings["websiteId"]);
            WebModel.Description = this.txtDescrpition.Text;
            WebModel.Keywords = this.txtKeywords.Text;
            WebModel.Title = this.txtTitle.Text;
            DbEntry.Update(WebModel);
            ModernDialog.ShowMessageText("保存成功！");
        }
    }
}
